<!DOCTYPE html>
<html lang="en"
      xmlns:th="http://www.thymeleaf.org"
      xmlns:layout="http://www.thymeleaf.org"
      layout:decorator="layout/pc_master">
<div layout:fragment="content" class="section page-content">
    <input type="hidden" id="type" value="bind">
    <!--    <link rel="stylesheet" href="/pc/css/center/setup/index.css">-->
    <!-- s: 导航 -->
    <div class="breadcrumb-wrap">
        <div class="layui-main clearfix">
            <div class="breadcrumb">
                <a href="/">首页</a> - <a href="/center">用户中心</a> - 设置
            </div>
        </div>
    </div>
    <!-- e: 导航 -->
    <div class="section page-content">
        <div class="layui-main clearfix">

         <div th:include="layout/center_left :: center_left" class="manage-aside"></div>

            <div class="manage-main">
                <ul class="layui-nav nav main-nav">
                    <li class="layui-nav-item layui-this">
                        <a href="/center/setup">
                            设置
                        </a>
                    </li>

                    <li class="layui-nav-item">
                        <a href="/center/setup/blacklist">
                            黑名单
                        </a>
                    </li>
                    <span class="layui-nav-bar" style="left: 92px; top: 57px; width: 0px; opacity: 0;"></span></ul>
                <div class="main-content">
                    <div style="margin:30px auto;width: 400px;">
                        <form action="/m/ajax/center/setup/updateemail" bottlecms-form-ajax="" method="post" refresh="refresh">
                            <input type="hidden" name="_method" value="PUT">
                            <div class="bcui-form newformbox">
                                <div style=" display: block; text-align: center; color: #999;" th:if="${userModel.email eq null or userModel.email eq ''}">
                                    您还没有绑定邮箱，赶快绑定吧～
                                </div>

                                <div style=" display: block; text-align: center; color: #999;" th:if="${userModel.email ne null and userModel.email ne ''}">
                                    已绑定邮箱：[[${userModel.email}]]
                                </div>
                                <div class="form-item">
                                    <input bottlecms-input="" type="text" name="email" id="email" placeholder="请输入新邮箱" class="">
                                </div>
                                <div class="form-item">
                                    <input bottlecms-input="" type="text" name="emailyzm" id="emailyzm" placeholder="验证码" class="" maxlength="6">

                                    <button class="btn btn-warning btn-sm sendEmail" type="button" style="position: absolute;top:50%; right: 5px; margin-top: -15px;">
                                        发送验证码
                                    </button>

                                </div>
                                <div class="form-item">
                                    <button class="btn  form-submit" type="submit">
                                        绑定
                                    </button>
                                </div>
                            </div>
                        </form>

                    </div>


                    <div style="height: 50px;"></div>




                </div>

            </div>

        </div>
    </div>

</div>
<div layout:fragment="contentFooter">
    <script type="text/javascript" src="/pc/js/home/login.js"></script>

<!--    <script type="text/javascript">-->
<!--        var _page = $('.page');-->
<!--        // 发送验证码-->
<!--        $(_page).on('click', '.sendEmail', function() {-->
<!--            var _this = this;-->
<!--            if ($(_this).hasClass("off")) return;-->
<!--            var email = $(_page).find("input[name='email']").val();-->
<!--            // if (email.length != 11) return bottlecms.toast("请输入正确手机号");-->
<!--            $(_this).addClass("off").text("发送中…");-->
<!--            var timer = null;-->
<!--            bottlecms.post(BOTTLECMS_HOME_PATH + "manage/user_email/sendemailcode", {-->
<!--                email: email-->
<!--            }, function(data) {-->
<!--                if (data.success == true) {-->
<!--                    clearInterval(timer); //这句话至关重要-->
<!--                    var time = 60;-->
<!--                    timer = setInterval(function() {-->
<!--                        if (time <= 0) {-->
<!--                            clearInterval(timer);-->
<!--                            $(_this).hasClass("off") && $(_this).removeClass("off").text("发送验证码");-->
<!--                        } else {-->
<!--                            $(_this).addClass("off").text("重新发送(" + time + ")");-->
<!--                            time&#45;&#45;;-->
<!--                        }-->
<!--                    }, 1000);-->
<!--                } else {-->
<!--                    bottlecms.toast(data.msg);-->
<!--                    $(_this).hasClass("off") && $(_this).removeClass("off").text("发送验证码");-->
<!--                }-->
<!--            },function(err){-->
<!--                $(_this).hasClass("off") && $(_this).removeClass("off").text("发送验证码");-->
<!--                if (err.status == 422) {-->
<!--                    var rdata = JSON.parse(err.responseText);-->
<!--                    for (var o in rdata) {-->
<!--                        return bottlecms.toast(rdata[o][0]);-->
<!--                    }-->
<!--                }-->
<!--            })-->
<!--        });-->

<!--    </script>-->

</div>
</html>